#!/usr/bin/env python
#coding:utf-8

import cgi
import cgitb;cgitb.enable()

print "Content-type: text/html"
print
print "<html><body>"
print """<p>请输入一个你喜欢的词:<br /></p>
<form method="post" action="cgi1.py">
<p>
<input type="text" name="word" />
<input type="submit" value="提交内容" />
</p>
</form>"""

form = cgi.FieldStorage()
if form.has_key("word"):  #判断字段中是否有值　
    print """<p>你输入的词是：<b>%s</b></p>""" % cgi.escape(form.getvalue("word","None"))
else:
    print """<p><em>你没有输入任何内容！</em></p"""

print "</body></html>"
